package com.omg.persistence.delegate.lifepoint;

import java.util.List;

import com.ibatis.dao.client.DaoManager;
import com.omg.persistence.dao.lifepoint.DaoConfig;
import com.omg.persistence.dao.lifepoint.entity.LPMessageRelation;
import com.omg.persistence.dao.lifepoint.iface.LPMessageRelationDao;

public class LPMessageRelationDelegate {

	private static volatile LPMessageRelationDelegate instance;
	private LPMessageRelationDao lpMessageRelationDao;
	private static final Object synObj = new Object();

	public static LPMessageRelationDelegate getInstance() {
		if (instance == null) {
			instance = new LPMessageRelationDelegate();
		}
		return instance;
	}

	private LPMessageRelationDelegate() {
		synchronized (synObj) {
			DaoManager daoMgr = DaoConfig.getDaoManager();
			this.lpMessageRelationDao = (LPMessageRelationDao) daoMgr
					.getDao(LPMessageRelationDao.class);
		}
	}

	public int addLPMessageRelation(LPMessageRelation lpMessageRelation) {
		return this.lpMessageRelationDao
				.addLPMessageRelation(lpMessageRelation);
	}

	public List<LPMessageRelation> getLPMessageRelationsByMessageId(
			String messageid) {
		return this.lpMessageRelationDao
				.getLPMessageRelationsByMessageId(messageid);
	}
}
